package com.spirng.leetcode.day06;

public class Test226 {
    public static void main(String[] args) {
        TreeNode root = new TreeNode(1,new TreeNode(2),new TreeNode(3));
        invertTree(root);
    }
    public static TreeNode invertTree(TreeNode root) {
         if(root==null) return root;
        TreeNode temp=root.left;
        root.left=root.right;
        root.right=temp;
         invertTree(root.left);
         invertTree(root.right);
         return root;
    }
}
